package org.zfes.snowier.common.monitor.http.okhttp3;

import java.util.Optional;

public class Main {

	public static void main(String[] sd) {
		
		//异步模式
		OkHttpManager.newIns()
//		.addHead("page", "1") 
//		.addParam("count", "2")
		.getAsyncJson("http://api.apiopen.top/getSongPoetry", jsonResponse -> {
			System.out.println(jsonResponse.getJson());
		});
		
		
////		//同步模式
//		Optional<String> s=OkHttpManager.newIns()
//		.addHead("param1", "head1") 
//		.addParam("param2", "val2")
//		.getJson("http://api.apiopen.top/singlePoetry", jsonres->{
////			jsonres.isok(val->{
////				VolumeStatus sss=JSON.parseObject(val, VolumeStatus.class);
////				
////			});
//			//VolumeStatus sss=JSON.parseObject(jsonres.getJson(), VolumeStatus.class);
//			return jsonres.getJson();
//		});
//		System.out.println(s.get());

	}



}
